package com.hzqy.service.hotel;


import java.util.Map;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.hzqy.commons.utils.PublicUtil;
import com.hzqy.persistence.dao.hotel.HotelWeatherForecastDao;
import com.hzqy.service.core.GenericServiceBean;
import com.hzqy.service.externalLink.ExternalLinkServiceBean;
import com.hzqy.web.vo.WlContentVo;
import com.hzqy.web.vo.weather.WeatherForecastVo;
@Service
public class HotelWeatherServiceBeen  extends GenericServiceBean<WeatherForecastVo,HotelWeatherForecastDao, Integer>{
	
	protected final Logger LOG = LoggerFactory.getLogger(getClass());
	
	@Resource
	private HotelWeatherForecastDao hotelWeatherForecastDao;
	@Resource
	private ExternalLinkServiceBean externalLinkServiceBean;
	
	public WeatherForecastVo selectWeatherForecastVoByHotel(WeatherForecastVo vo,WlContentVo wlContentVo) {
		WlContentVo wlc = externalLinkServiceBean.selectWLContentAvaliable(wlContentVo);//是否可以访问
		if(wlc!=null){
			//WeatherCacheUtil wcu = new WeatherCacheUtil(hotelWeatherForecastDao);
			String dateTime = PublicUtil.getCurDateTime("YYYY-MM-dd");
			vo.setF_wf_date(dateTime);
			vo = hotelWeatherForecastDao.selectWeatherForecastVoByHotel(vo);
			if(vo==null){
				vo = new WeatherForecastVo();
			}
			LOG.debug("wfdate:"+vo.getF_wf_date()+";daytime_weather:"+vo.getF_wf_daytime_weather());
		}else{
			vo = new WeatherForecastVo();
		}
		return vo;
	}

	@Override
	public HotelWeatherForecastDao getEntityDao() {
		return hotelWeatherForecastDao;
	}
	
}

